package com.example.demo.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class EnvironmentUtil {
    @Autowired
    private Environment environment;

    public String Name() {
        return environment.getProperty("person.name");
    }

    public String[] GetActiveProfiles() {
        String[] activeProfiles = environment.getActiveProfiles();
        return activeProfiles;
    }
    @Scheduled(cron="0 * * * * *")
    public void doSomething() {
        System.out.println("do something");
    }
}
